Method and terminal device for selecting character

ABSTRACT

The present disclosure discloses a method and a terminal device for selecting a character. The method includes: detecting a touch point of a user gesture acting on the touch screen, wherein the touch point falls into a touch point node; searching a plurality of nodes of the contents to find a nearest text node to the touch point, when the touch point node is not a text node; and selecting a nearest character to the touch point within the nearest text node. Therefore, by taking the nearest character to the touch point in the nearest text node as the character selected by the touch point, even if the touch point of a user gesture does not fall on a character, it is still possible to obtain the character selected by the user gesture, thereby repeated selecting operations may be avoided, so as to provide convenience for the user.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation-In-Part of International ApplicationPCT/CN2014/077098, with an international filing date of May 9, 2014,which claims the benefit of priority to Chinese Patent Application No.201310452543.2, filed on Sep. 27, 2013, the entire contents of which areincorporated herein by reference.

TECHNICAL FIELD

The present disclosure generally relates to a field of computertechnology, and more particularly, to a method and terminal device forselecting a character from content displayed in a touch screen.

BACKGROUND

With continuous development of mobile terminal technology, mobiledevices such as smart mobile phones, tablet PCs are becomingincreasingly popular in daily lives. Currently, the vast majority ofmobile terminals are equipped with touch screens, on which various usergestures may be performed by users to operate the mobile terminal.

For example, a user may come across a favorite article, phrase orsentence that he/she intends to copy when browsing a webpage on a mobileterminal. Then, a touch gesture may be used to select characters in acorresponding location. The touch gestures commonly used include, forexample, a long press, a double click or a single click.

However, when the characters displayed on a touch screen are too smallor a user cannot precisely controls touch points of his/her gesture,such method for selecting a character cannot allow the user to select acharacter accurately through a touch gesture. For example, when thecharacters displayed on the touch screen are too small, a long pressgesture of the user is likely to fall into a location between two linesof characters or in some other space area. Then, the terminal device maynot select the characters for the user since the touch point of the userdoes not fall on the characters.

SUMMARY

Accordingly, the present disclosure provides a method and terminaldevice for effectively selecting a character even if the gesture actingon the touch screen does not fall on the characters.

According to a first aspect of the embodiments of the presentdisclosure, the present disclosure provides a method for selecting acharacter from content displayed in a touch screen, comprising:detecting a touch point of a user gesture acting on the touch screen,wherein the touch point falls into a touch point node; searching aplurality of nodes of the contents to find a nearest text node to thetouch point, when the touch point node is not a text node; and selectinga nearest character to the touch point within the nearest text node.

According to an embodiment of the present disclosure, even if the touchpoint of the user gesture does not fall on a character, the terminaldevice is still able to search and select a character from the contentsdisplayed in the touch screen as “the selected character”, therebyrepeated selecting operations may be avoided, so as to provideconvenience for the user.

According to a second aspect of the embodiments of the presentdisclosure, the present disclosure further provides an apparatus forselecting a character from content displayed in a touch screen,comprising: a detection module configured to detect a touch point of auser gesture acting on the touch screen, wherein the touch point fallsinto a touch point node; a searching module configured to search aplurality of nodes of the contents to find a nearest text node to thetouch point, when the touch point node is not a text node; and aselection module configured to select a nearest character to the touchpoint within the nearest text node.

According to a third aspect of the embodiments of the presentdisclosure, the present disclosure provides a terminal device such as asmart electronic terminal device. The terminal device includes a touchscreen display for displaying content; a processor; and a memory forstoring instructions executable by the processor, wherein the processoris configured to execute instructions for: detecting a touch point of auser gesture acting on the touch screen, wherein the touch point fallsinto a touch point node; searching a plurality of nodes of the contentsto find a nearest text node to the touch point, when the touch pointnode is not a text node; and selecting a nearest character to the touchpoint within the nearest text node.

According to a fourth aspect of the embodiments of the presentdisclosure, a non-transitory readable storage medium includinginstructions, executable by a processor in a terminal device, forperforming the method for selecting a character from content displayedin a touch screen, the method comprising: detecting a touch point of auser gesture acting on the touch screen, wherein the touch point fallsinto a touch point node; searching a plurality of nodes of the contentsto find a nearest text node to the touch point, when the touch pointnode is not a text node; and selecting a nearest character to the touchpoint within the nearest text node.

Other characters and advantages of the present disclosure will be setforth in the following description, and will in part become apparentfrom the description, or may be appreciated through the practice of thepresent disclosure. The objects and other advantages of the presentdisclosure may be realized and obtained through the structuresparticularly pointed out in the written description, the claims and theaccompanying drawings.

It may be appreciated that, the above general description and thefollowing detailed description below are merely exemplary, and do notlimit the disclosure. The technical solution of the present disclosurewill be described in further detail with reference to accompanyingdrawings and embodiments.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings which constitute a part of the description andserve to explain the present disclosure together with the embodiments ofthe present disclosure, are provided for a better understanding of thepresent disclosure, but do not constitute a limitation to the presentdisclosure. In the drawings:

FIG. 1 is a schematic flowchart collectively illustrating a method forselecting a character according to an embodiment of the presentdisclosure;

FIG. 2 is a schematic flowchart illustrating an example for selecting acharacter by performing a hierarchical search according to an embodimentof the present disclosure;

FIG. 3 is a schematic view illustrating an example of a plurality ofnodes of the contents according to an embodiment of the presentdisclosure;

FIG. 4 is a schematic view illustrating an example of eight zones aroundthe text node according to an embodiment of the present disclosure;

FIG. 5 is a schematic view illustrating an example of eight zones aroundthe text node in a rectangular coordinate system according to anembodiment of the present disclosure;

FIG. 6 is a schematic view illustrating an example of selecting anearest character from the found text node according to an embodiment ofthe present disclosure;

FIG. 7 is a block diagram illustrating an apparatus for selecting acharacter according to an embodiment of the present disclosure;

FIG. 8 is a block diagram illustrating a searching module in theapparatus for selecting a character according to an embodiment of thepresent disclosure;

FIG. 9 is a block diagram illustrating another example of a searchingmodule in the apparatus for selecting a character according to anembodiment of the present disclosure;

FIG. 10 is a block diagram illustrating a calculation unit in thesearching module in the apparatus for selecting a character according toan embodiment of the present disclosure;

FIG. 11 is a block diagram illustrating a selection module in theapparatus for selecting a character according to an embodiment of thepresent disclosure; and

FIG. 12 is a block diagram illustrating a terminal device according toan embodiment of the present disclosure.

Explicit embodiments of the present disclosure that have beenillustrated in the above accompanying drawings will be described in moredetail hereinafter. These accompanying drawings and description are byno means intended to limit the scope of the idea of the presentdisclosure, but to explain the concept of the present disclosure tothose skilled in the art with reference to particular embodiments.

DETAILED DESCRIPTION

In order to make the objects, the technical solutions and advantagesmore clear, the present disclosure will be described in further detailwith reference to the embodiments and the accompanying drawings. Here,the illustrative embodiments of the present disclosure and thedescription thereof are not intended to limit the present disclosure,but to explain the present disclosure.

Data content, such as a character or image can be displayed in a touchscreen of a terminal device, such as a mobile phone and a personaldigital assistant (PDA), etc. The terminal device includes a touchscreen not only for displaying content but also receiving user gesturesacting on the touch screen. The content are represented by usingstructured data formats (such as a tree data format) to include aplurality of data elements. In the present disclosure, a data elementincluded in contents displayed in the touch screen is referred as “anode”. Accordingly, the content displayed in the touch screen mayinclude a plurality of nodes. The types and definition of nodes arepredefined for the nodes inserted into the content. Webpage contentdisplayed in the touch screen, for example, may include a plurality ofnodes, wherein only some nodes of the webpage content belong to textnodes. The present disclosure provides a method for flexibly selecting acharacter even when the touch point of a user's gesture does not fall onthe characters or falls into text nodes.

FIG. 1 is a schematic flowchart collectively illustrating a method forselecting a character according to an embodiment of the presentdisclosure.

As shown in FIG. 1, in step S101, a touch point of a user gesture actingon the touch screen is detected. In this case, the user gesture, such asa long press, a double click or a single click is acted on the touchscreen by the user, consequently the user gesture generates a touchpoint on the touch screen. Because the contents displayed in the touchscreen are represents as a plurality of nodes, the touch point fallsinto at least one of the plurality of nodes. The node where the touchpoint falls into is referred as a touch point node in the presentdisclosure.

In step S102, a plurality of nodes of the contents to find a nearesttext node to the touch point is searched, when the touch point node isnot a text node. Before proceeding to step S102, the terminal deviceneeds to identify whether the user gesture acted on the display is auser gesture for selecting characters within the content. According tothe present disclosure, the terminal device presets some specificgesture such as a long press, a double click or a single click acted onthe touch screen as the gestures for selecting text (“text capturegestures”). Therefore, for example, in case that the long press ispreset as one of the gestures for selecting characters, the terminaldevice determines whether the touch point node where the touch point ofthe user gesture falls into is a text node if the touch screen detect along press.

When the touch point node itself is a text node, the method proceed toselect a character in the touch point node according to characterselection rules disclosed in the prior art. However, when the touchpoint node is not a text node, the method proceeds to step S102 tosearch for other nodes of the contents to find a nearest text node tothe touch point.

In step S103, a nearest character to the touch point within the nearesttext node is selected. After finding the nearest text node, the methodproceeds to step S103 to determine a character to be selected becausethere may include at least one character in the nearest text node.According to the present disclosure, a nearest character to the touchpoint within the nearest text node is determined as “the selectedcharacter”.

Here, the text node is a visible text node.

In the present disclosure, the nearest character within the nearest textnode to the touch point is selected as “the character selected by thetouch point” even if the touch point of the gesture does not fall into atext node. It may be realized that the character may still be selectedeven if the touch point of the text capture gesture does not fall on acharacter, thereby repeated selecting operations may be avoided, so asto provide convenience for the user.

In the method for selecting a character according to an embodiment ofthe present disclosure, the step of searching the nearest text node tothe touch point may be started from a node where the touch point islocated, namely the touch point node, to perform a hierarchical searchto find text nodes associated with the touch point; then distancesbetween the touch point and each of the found text nodes are calculated;and the calculated text node with a smallest distance is determined asthe nearest text node to the touch point that has been searched out. Byperforming a hierarchical search according to levels of the nodes,searching efficiency may be improved. In addition, the node levels maybe further restricted, thereby a balance between the speed of the searchand the granularity of the search may be obtained.

FIG. 2 is a schematic flowchart illustrating an example for selecting acharacter according to an embodiment of the present disclosure. In thisexample, the plurality of nodes of contents are organized as a nodetree. The data contents to be displayed in a user interface, such as awebpage interface, are organized into a node tree with a plurality ofnodes. All nodes can be accessed through the tree. The tree starts atthe root node and branches out to the lowest level node of the tree. Thenodes in the node tree have a hierarchical relationship to each other.The terms parent, child and sibling are used to describe therelationships of the nodes. Parent nodes have children nodes. Childrennodes on the same level are called siblings nodes. Each node in the nodetree possesses a level, which is defined by 1+the number of connectionsbetween the node and the root node. The name, type, definition andparameters of nodes are predefined for each of the plurality of nodes inthe node tree. For example, some of the nodes are defined as text nodesto contain text. The node tree can be organized by using structured dataformats, for example, Extensible Markup Language (XML). It should beunderstood that the XML structure is by way of example as thefunctionality of the present disclosure is equally applicable to anydata format for allowing the user to select a character.

With reference to FIG. 2, the hierarchical search is started from thetouch point node, then to sibling nodes of the touch point node, and tosibling nodes of parent node of the touch point node, thereby to obtainthe character selected by the touch point. For example, the processincludes the following steps.

In step S201, a user gesture for selecting a character is received bythe touch screen from a user.

In step S202, a touch point of the user gesture is determined.

In step S203, whether the touch point falls into a text node isdetected; if yes, the method proceeds to step S204; otherwise, themethod proceeds to step S205.

In step S204, because the touch point node itself is a text node, acharacter in the touch point node is taken as the character selected bythe touch point.

In step S205, the touch point node is looked up to see whether the touchpoint node contains any child text node; if yes, the method proceeds tostep S209 the method proceeds to step S206.

In step S206, sibling nodes of the touch point node are looked up to seewhether the sibling node of the touch point node contains any text node;if yes, the method proceeds to step S209; otherwise the method proceedsto step S207.

In step S207, sibling nodes of the parent node of the touch point nodeare looked up to see whether the sibling node of the parent nodecontains any text node; if yes, the method proceeds to step S209;otherwise the method proceeds to step S208.

In step S208, the parent node of the touch point node, is taken as thecurrent touch point node to proceed to step S207.

In step S209, distances from the touch point to each the text nodes thathave been found, is calculated.

In step S210, the text node of the smallest distance is determined asthe nearest text node to the touch point. In other words, the text nodeof the smallest distance is determined as “the nearest text node”.

In step S211, the nearest character to the touch point, in the foundtext node is taken as “the character selected by the touch point”.

In some exemplary embodiments, before the method further includes a stepof determining whether the current node is a body node before the methodproceeds to steps 205, 206 and 207. For example, before determiningwhether the touch point node contains any text node in the step S205, itshould be determined whether the touch point node is a body node. Ifyes, the method ends. Similarly, before determining whether the siblingnode of the touch point node contains any text node in the step S206, itshould be determined whether the sibling node of the touch point node isa body node. If yes, the method ends. Likewise, before the step S207, itshould be determined whether the sibling node of the parent node of thetouch point node is a body node. If yes, the method ends.

In this embodiment, an exhaustive search method is applied. For example,in an interface shown in FIG. 3, a node 302 contains two children nodes303 and 304. The node 305 is a sibling node of node 302 and the node 306is the parent node of node 302. When the user gesture generates a touchpoint 301 on the touch screen, it is detected that the touch point 301falls into the node 302. Accordingly, in this example, the node 306 is atouch point node. If the node 302 is not a text node, the terminaldevice will perform a hierarchical search. At first, it determineswhether the node 302 contains any text node first. In other words, itdetermines whether the children node 303 or 304 is a text node. Ifneither of nodes 303 and 304 contained in the node 302 is a text node,the sibling node 305 of the node 302 is looked up to determine whetherthe sibling node 305 contains any children text node. If no text node iscontained in the node 305, sibling nodes 307 and 308 of the parent node306 of the node 302 are respectively looked up to determine whethereither of the sibling nodes 307 and 308 of the parent node 306 containsany children text node.

Furthermore, if there is still no text node contained in either of thenodes 307 and 308, the parent node 306 of the node 302 is taken as thecurrent touch point node, and sibling nodes 310 and 311 of the parentnode 309 of the current touch point node 306 is looked up to determinedwhether either of the nodes 310 and 311 contains any children text node.In the present disclosure, the term “touch point node” represents a nodeinto which the touch point falls. Therefore, if the node 302 is a touchpoint node, its parent node 306 must be a touch point node too. In otherword, the “touch point node” of the present disclosure does not onlyinclude the smallest node accommodating the touch point, but alsoincludes the parent node of the smallest node. Accordingly, if there isno text node found when the smallest node is regarded as the touch pointnode, the parent node of the smallest node will be taken as the currenttouch point node to repeat the above steps S203-211.

In step S209 of the above embodiment, if at least one text node isfound, based on the coordinates of the touch point and the coordinatesof at least one found text node, it may be determined first which areaaround the found text node the touch point is located in, and then thedistance from the touch point to each of the at least one found textnode may be calculated according to which area around the found textnode the touch point is located in. Depending on which area the touchpoint is located in, different distance calculation methods are applied,therefore calculation efficiency may be improved. Hereinafter, withreference to examples, it will be illustrated how the distance from thetouch point to each found text node is calculated according to whicharea around the found text node the touch point is located in.

A node in an interface, such as a webpage interface, normally occupies arectangular area. Based on coordinates of the touch point andcoordinates of each of vertexes of the node, it may be determined whicharea of the node the touch point is located in. As shown in FIG. 4, inthis example, the rectangular area around the text node is divided into8 areas, respectively being: an upper left area 401, a left area 402, alower left area 403, a lower area 404, a lower right area 405, a rightarea 406, an upper right area 407 and an upper area 408. Based on thecoordinate of each of the four vertexes of the text node and thecoordinate of the touch point, it is determined which area of the 8areas the touch point is located in.

For example, taking the coordinate system shown in FIG. 5 as an example,the coordinates of the four vertexes of the rectangular text node in thecoordinate system are respectively A(x₁, y₁), B(x₁, y₂), C(x₂, y₂) andD(x₂, y₁). The coordinate of the touch point P is P(m, n). Which areathe touch point is located in may be determined by comparing thecoordinate of the touch point and the coordinates of the rectangulararea, and different algorithm may be selected according to differentarea to calculate the distance from the touch point to the text node.

For example, if m<x₁, and n<y₂, the touch point P is located in theupper left area 401 of the text node. In this case, the distance S fromthe touch point P to the text node is √{square root over((x₁−m)²+(n−y₂)²)}.

If m<x₁, and y₂≦n≦y₁, the touch point P is located in the left area 402of the text node. In this case, the distance S from the touch point P tothe text node is |x₁−m|.

If m<x₁, and n>y₁, the touch point P is located in the lower left area403 of the text node. In this case, the distance S from the touch pointP to the text node is √{square root over ((x₁−m)²+(n−y₁)²)}.

If x₁≦m≦x₂, and n>y₁, the touch point P is located in the lower area 404of the text node. In this case, the distance S from the touch point P tothe text node is |y₁−n|.

If m>x₂, and n>y₁, the touch point P is located in the lower right area405 of the text node. In this case, the distance S from the touch pointP to the text node is √{square root over ((x₂−m)²+(y₁−n)²)}.

If m>x₂, and y₂≦n≦y₁, the touch point P is located in the right area 406of the text node. In this case, the distance S from the touch point P tothe text node is |m−x₂|.

If m>x₂, and n<y₂, the touch point P is located in the upper right area407 of the text node. In this case, the distance S from the touch pointP to the text node is √{square root over ((x₂−m)²+(y₂−m)²)}.

If x₁≦m≦x₂, and n<y₂, the touch point P is located in the upper area 408of the text node. In this case, the distance S from the touch point P tothe text node is |n−y₂|.

To summarize, after finding at least one text node, the coordinates ofthe touch point and the coordinates of each found text node are comparedfirst. Then the distance from the touch point to each found text node iscalculated according to which area of the eight adjacent areas the touchpoint is located in. After calculating the distance for each of all thefound text nodes, the text node with a smallest distance is determinedas the nearest text node.

In step S211 of the above embodiment, because there may include aplurality of characters in the found nearest text node, the nearestcharacter to the touch point within the nearest text node is selected.Based on coordinates of the touch point and coordinates of the nearesttext node, it may be determined first which area around the nearest textnode the touch point is located in. Then a location of the nearestcharacter to the touch point, in the nearest text node may be determinedaccording to which area around the nearest text node the touch point islocated in.

Here, the determination of which area around the nearest text node thetouch point is located in may use the above method for determining whicharea the touch point is located in, and will not be repeated any more.

Taking the example of the divided areas shown in FIG. 5, if the touchpoint is located in the upper left area 401 of the nearest text node, ahorizontal coordinate of the location of the nearest character to thetouch point, in the nearest text node is:

${x_{1} + {\frac{1}{2} \times w}},$and a longitudinal coordinate thereof is:

${y_{2} + {\frac{1}{2} \times h}},$as shown by a point E in FIG. 6.

If the touch point is located in the left area 402 of the nearest textnode, a horizontal coordinate of the location of the nearest characterto the touch point, in the nearest text node is:

${x_{1} + {\frac{1}{2} \times w}},$and a longitudinal coordinate thereof is: n.

If the touch point is located in the lower left area 403 of the nearesttext node, a horizontal coordinate of the location of the nearestcharacter to the touch point, in the nearest text node is:

${x_{1} + {\frac{1}{2} \times w}},$and a longitudinal coordinate thereof is:

$y_{1} - {\frac{1}{2} \times {h.}}$

If the touch point is located in the lower area 404 of the nearest textnode, a horizontal coordinate of the location of the nearest characterto the touch point, in the nearest text node is: m, and a longitudinalcoordinate thereof is:

$y_{1} - {\frac{1}{2} \times {h.}}$

If the touch point is located in the lower right area 405 of the nearesttext node, a horizontal coordinate of the location of the nearestcharacter to the touch point, in the nearest text node is:

${x_{2} - {\frac{1}{2} \times w}},$and a longitudinal coordinate thereof is:

$y_{1} - {\frac{1}{2} \times {h.}}$

If the touch point is located in the right area 406 of the nearest textnode, a horizontal coordinate of the location of the nearest characterto the touch point, in the nearest text node is:

${x_{2} - {\frac{1}{2} \times w}},$and a longitudinal coordinate thereof is: n.

If the touch point is located in the upper right area 407 of the nearesttext node, a horizontal coordinate of the location of the nearestcharacter to the touch point, in the nearest text node is:

${x_{2} - {\frac{1}{2} \times w}},$and a longitudinal coordinate thereof is:

$y_{2} + {\frac{1}{2} \times {h.}}$

If the touch point is located in the upper area 408 of the nearest textnode, a horizontal coordinate of the location of the nearest characterto the touch point, in the nearest text node is: m, and a longitudinalcoordinate thereof is:

$y_{2} + {\frac{1}{2} \times {h.}}$

Wherein, w is a width of the character, and h is a height of thecharacter. Through the above method for determining the location of thecharacter, since the width of the character and the height of thecharacter is taken into consideration, it may be ensured that thecharacter can be displayed on the corresponding location, so as toprovide the character selected by the touch point.

It may be noticed that, the coordinate system in the above example inthe present disclosure is merely for illustration, and not intended tolimit the present disclosure. Alteration may be made based on the basicidea according to the above embodiment by those skilled in the art. Forexample, other coordinate systems may be used or the directions of thecoordinate axes may be altered, and so on.

Accordingly, as shown in FIG. 7, the present disclosure further providesan apparatus for selecting a character. The apparatus includes: adetection module 701, configured to detect a touch point of a usergesture acting on the touch screen; a searching module 702, configuredto search a plurality of nodes of the contents to find a nearest textnode to the touch point; and a selection module 703, configured toselect a nearest character to the touch point within the nearest textnode is selected.

As shown in FIG. 8, the searching module 702 includes: a first levelsearching unit 801, configured to determine whether the touch point nodecontains any text node; calculate the distance between the touch pointand each text node contained in the touch point node when the touchpoint node contains at least one text node; and select the text node ofthe smallest distance as the nearest text node to the touch point.

Furthermore, the searching module 702 may include a second levelsearching unit 802, configured to determine whether a sibling node ofthe touch point node contains any text node, when the touch point nodedoes not contain at least one text node; and calculate the distancebetween each text node contained in the sibling node and the touch pointwhen the sibling node contains at least one text node.

Moreover, the searching module 702 may include a third level searchingunit 803, configured to determine whether a sibling node of a parentnode of the touch point node contains any text node, when none of thesibling nodes of the touch point node contains any text node; andcalculate the distance between each text node contained in the siblingnode of the parent node of the touch point node and the touch point whenthe sibling node of the parent node of the touch point node contains atleast one text node.

As shown in FIG. 9, the searching module 702 further includes: a judgingunit 804, configured to judge whether the touch point node is a bodynode.

As shown in FIG. 10, the calculation unit 802 includes: an areadetermination sub unit 1001, configured to determine the coordinates ofthe four vortex of the at least one text node; and a calculation subunit 1002, configured to calculate the distance between the touch pointand each text node according to the coordinates of the touch point andthe coordinates of the four vortex of the at least one text node.Moreover, the calculation sub unit 1002 is further configured toimplement the steps described above by referring to FIG. 4.

As shown in FIG. 11, the selection module 703 includes: acharacter-location determination unit 1101, configured to determine thecoordinates of the nearest character to the touch point, in the nearesttext node according to the area around the nearest text node the touchpoint is located in; and a selection unit 1102, configured to select thecharacter according to the determined coordinates as a characterselected by the touch point.

Moreover, in an embodiment, the text node is a visible text node.

The present disclosure further provides a terminal device. FIG. 12 is ablock diagram illustrating a terminal device according to an embodimentof the present disclosure. Referring to FIG. 12, the terminal device maybe configured to perform the method for selecting a character accordingto an embodiment of the present disclosure.

The terminal device 1100 may include a communication unit 110, a memory120 including one or more computer-readable storage media, an input unit130, a display unit 140, a sensor 150, an audio circuit 160, a WiFi(Wireless Fidelity) module 170, a processor 180 including one or moreprocessing cores and a power supply 190, etc. It may be appreciated bythose skilled in the art that, the structure of the terminal deviceshown in FIG. 12 does not constitute a limitation to the terminaldevice, and it may include more or less components than what isillustrated, or combine some components, or have different componentarrangements. Wherein:

The communication unit 110 may be configured to transmit and receiveinformation, or to transmit and receive signal during a procedure ofcalling. The communication unit 110 may be a network communicationdevice such as a RF (Radio Frequency) circuit, a router and a modem,etc. In particular, when the communication unit 110 is a RF circuit, thecommunication unit 110 receives downlink information from a basestation, and then transfers the information to one or more processors180 to be processed. Also, the communication unit 110 transmits uplinkdata to the base station. Generally, the RF circuit as a communicationunit includes, but is not limited to, an antenna, at least oneamplifier, a tuner, one or more oscillators, a subscriber identitymodule (SIM) card, a transceiver, a coupler, an LNA (Low NoiseAmplifier) and a duplexer, etc. Furthermore, the communication unit 110may communicate with a network and other devices through wirelesscommunication. The wireless communication may use any communicationstandards or protocols, including, but being not limited to, GSM (GlobalSystem of Mobile communication), GPRS (General Packet Radio Service),CDMA (Code Division Multiple Access), WCDMA (Wideband Code DivisionMultiple Access), LTE (Long Term Evolution), e-mail and SMS (ShortMessaging Service), etc. The memory 120 may be configured to storesoftware programs and modules. The processor 180 performs variousfunctional applications and data processing by running the softwareprograms and modules stored in the memory 120. The memory 120 maygenerally include a program storage area and a data storage area,wherein the program storage area may store operating systems,application programs required by at least one function (such as afunction of sound playback and a function of image playback, etc.),etc.; and the data storage area may store data created during operationof the terminal device 1100 (such as audio data and a phone book, etc.),etc. In addition, the memory 120 may include a high-speed random accessmemory and may also include a non-volatile memory. For example, thememory 120 may include at least one disk storage device, a flash memorydevice or other volatile solid-state memory devices. Accordingly, thememory 120 may also include a memory controller to provide access to thememory 120 performed by the processor 180 and the input unit 130.

The input unit 130 may be configured to receive input numbers or acharacter, and generate keyboard, mouse, joystick, optical or trackballinput signals related to a user setting and the functional control. Theinput unit 130 may include a touch sensitive surface 131 and other inputdevice 132. The touch sensitive surface 131, is also known as a touchscreen or a track pad, may collect user's gestures on or near it (suchas an operation performed by users using any suitable object oraccessory such as a finger, a touch pen and the like on or near thetouch sensitive surface 131), and drive a corresponding connected deviceaccording to a preset program. Optionally, the touch sensitive surface131 may include two parts of a touch detection device and a touchcontroller. Here, the touch detection device detects a touching positionof the user, detects a signal caused by the user gesture, and transmitsthe signal to the touch controller. The touch controller receives touchinformation from the touch detection device, transforms it intocoordinates of the touch point, and sends the coordinates to theprocessor 180. The touch controller may also receive a command from theprocessor 180 and execute the command. In addition, the touch sensitivesurface 131 may be realized in various types, such as resistive type,capacitive type, infrared type and surface acoustic wave type, etc. Inaddition to the touch sensitive surface 131, the input unit 130 may alsoinclude other input device 132. The other input device 132 may include,but is not limited to, one or more of a physical keyboard, functionalkeys (such as volume control keys, switch buttons, etc.), a trackball, amouse and a joystick, etc.

The display unit 140 may be configured to display information input bythe user or information provided for the user and various graphical userinterfaces of the terminal device 1100. These graphical user interfacesmay consist of graphics, texts, icons, videos and any combinationthereof. The display unit 140 may include a display panel 141, andoptionally, the display panel 141 may be configured with LCD (LiquidCrystal Display) or OLED (Organic Light-Emitting Diode), etc. Further,the touch sensitive surface 131 may cover the display panel 141. When auser gesture on or near the touch sensitive surface 131 is detected bythe touch sensitive surface 131, the user gesture is sent to theprocessor 180 to determine the type of touch event, and thencorresponding visual output will be provided on the display panel 141 bythe processor 180 according to the type of touch event. Although in FIG.12, the touch sensitive surface 131 and the display panel 141 are twoseparate components to realize input and output functions, in someembodiments, the touch sensitive surface 131 and the display panel 141may be integrated to realize input and output functions.

The terminal device 1100 may further include at least one kind of sensor150, such as a light sensor, a motion sensor and other sensors. Thelight sensor may include an ambient light sensor and a proximity sensor.Here, the ambient light sensor may adjust the brightness of the displaypanel 141 according to the brightness of the ambient light. Theproximity sensor may turn off the display panel 141 and/or backlightwhen the terminal device 1100 moves close to ear. As one kind of themotion sensor, a gravity acceleration sensor may detect accelerations inevery direction (typically on three axes), and may detect the magnitudeand the direction of gravity when it is stationary, which may be used inapplications for recognizing poses of the mobile phone (such ashorizontal and vertical screen switching, related games and posecalibration of a magnetometer) and functions related to vibrationrecognizing (such as a pedometer and knocking), etc. The terminal device1100 may also be equipped with other sensors such as a gyroscope, abarometer, a hygrometer, a thermometer and an infrared sensor, etc.,which will not be redundantly described herein.

The audio circuit 160, a speaker 161 and a microphone 162 may provide anaudio interface between the user and the terminal device 1100. The audiocircuit 160 may transform received audio data into electrical signalswhich are transmitted to the speaker 161 and transformed into soundsignals to be output by the speaker 161. On the other hand, themicrophone 162 transforms collected sound signals into electricalsignals which are received and transformed into audio data by the audiocircuit 160. After being output to the processor 180 to be processed,the audio data is transmitted to, for example, another terminal devicevia the RF circuit 110, or output to the memory 120 for furtherprocessing. The audio circuit 160 may also include an ear bud jack toallow a communication between an external earphone and the terminaldevice 1100.

In order to achieve wireless communication, the terminal device may beequipped with a wireless communication unit 170 which may be a WiFimodule. WiFi is a short-range wireless transmission technology. Theterminal device 1100 allows the user to send and receive emails, browsewebpages and access streaming media, etc, through the wirelesscommunication unit 170, which provides the user with a wirelessbroadband Internet access. Although FIG. 12 shows the wirelesscommunication unit 170, it may be appreciated that, the wirelesscommunication unit 170 may not a component of the terminal device 1100,and may be omitted as desired without changing the scope of thedisclosure.

The processor 180 is a control center of the terminal device 1100 thatconnects various parts of the entire mobile phone through variousinterfaces and circuits, performs various functions and data processingof the terminal device 1100 by running or executing the softwareprograms and/or modules stored in the memory 120 and by invoking datastored in the memory 120, so as to monitor the overall mobile phone.Optionally, the processor 180 may include one or more processing cores.The processor 180 may be integrated with an application processor thatgenerally processes operating systems, user interfaces and applicationprograms, and a modem processor that generally processes the wirelesscommunication. It may be appreciated that, the above modem processor maynot be integrated into the processor 180.

The terminal device 1100 may also include the power supply 190 (such asa battery) to supply power to each component. The power supply may belogically connected to the processor 180 through a power supplymanagement system, so as to achieve the functions such as charge,discharge and power consumption managements, etc. through the powersupply management system. The power supply 190 may also include one ormore components of a DC or AC power, a recharge system, a power failuredetection circuit, a power converter or an inverter and a power statusindicator, etc.

Although not shown, the terminal device 1100 may also include a cameraand a Bluetooth module, etc., which are not redundantly describedherein. In the present embodiment, the display unit of the terminaldevice is a touch screen display, and the terminal device furtherincludes a memory and one or more programs stored in the memory, and theterminal device is configured to execute the one or more programs by oneor more processors, and the one or more programs containing instructionsto perform the following operations: detecting a touch point of a usergesture acting on the touch screen, wherein the touch point falls into atouch point node; searching a plurality of nodes of the contents to finda nearest text node to the touch point, when the touch point node is nota text node; and selecting a nearest character to the touch point withinthe nearest text node.

In addition, the mobile terminal according to an embodiment of thepresent disclosure may typically be various handheld terminal devicessuch as a mobile phone and a personal digital assistant (PDA), etc.Therefore, the scope of the present disclosure is not limited to aparticular type of mobile terminal.

In addition, the method according to an embodiment of the presentdisclosure may also be implemented as a computer program executed by aCPU. When executed by the CPU, the computer program performs the abovefunctions defined in the method according to an embodiment of thepresent disclosure.

In addition, the above steps of the method and the units of the systemmay also by implemented with a controller and a computer-readablestorage device which stores computer programs that cause the controllerto realize the above steps and functions of the units.

In addition, it may be appreciated that the above mentionedcomputer-readable storage device may be a volatile memory or anonvolatile memory, or may include the both. For example, but withoutlimitation, the nonvolatile memory may include a read only memory (ROM),a programmable ROM (PROM), an electrically programmable ROM (EPROM), anelectrically erasable programmable ROM (EEPROM) or a flash memory. Thevolatile memory may include a random access memory (RAM) which may serveas an external cache RAM memory. As an example, but without limitation,the RAM may be of various forms, such as a synchronous RAM (DRAM), adynamic RAM (DRAM), a synchronous DRAM (SDRAM), a double data rate SDRAM(DDR SDRAM), an enhanced SDRAM (ESDRAM), a synchronous link DRAM(SLDRAM) and a direct Rambus RAM (DRRAM). The storage device accordingto the disclosed aspects is intended to include but is not limited tothese and other suitable types of memories.

It may be appreciated by those skilled in the art that, variousexemplary logical blocks, modules, circuits and algorithm stepsdescribed in conjunction with the present disclosure may be implementedas electronic hardware, computer software or combination of both. Inorder to clearly illustrate the interchangeability between the hardwareand the software, a general description has been given to variousillustrative components, blocks, modules, circuits and functions ofsteps. Whether such functions will be implemented as software orhardware depends on particular applications and the restrictions appliedto the design of the whole system. Those functions may be realized invarious means with respect to each of the particular applications bythose skilled in the art without departing the scope of the presentdisclosure.

Various illustrative logical blocks, modules and circuits described inconjunction with the present disclosure may be implemented or performedby the following components that are designed to perform the abovefunctions: a general purpose processor, a digital signal processor(DSP), a dedicated integrated circuit (ASIC), a field programmable gatearray (FPGA) or other programmable logic device, discrete gates ortransistor logics, discrete hardware components or any combination ofthese components. The general purpose processor may be a microprocessor.Alternatively, the processor may be any one of a conventional processor,a controller, a microcontroller or a state machine. The processor may beimplemented as combination of computing devices, such as combination ofa DSP and a microprocessor, a plurality of microprocessors, one or moremicroprocessors in conjunction with a DSP core, or any other suchconfiguration.

The method and steps of the algorithm described in conjunction with thepresent disclosure may be directly contained in hardware, in a softwaremodule executed by a processor or in combination of the both. Thesoftware may reside in a RAM memory, a flash memory, a ROM memory, anEPROM memory, an EEPROM memory, a registers, a hard disk, a removabledisk, a CD-ROM, or any other storage medium known in the art. Anexemplary storage medium is coupled to the processor such the processorcan read information from the storage medium or write informationthereto. In an alternative embodiment, the storage medium maybeintegrated with the processor. The processor and the storage medium mayreside in an ASIC which may reside in a user terminal. In an alternativeembodiment, the processor and the storage medium may reside in a userterminal as discrete components.

In one or more exemplary designs, the above functions may be implementedin hardware, software, firmware or any combination thereof. Ifimplemented in software, the above functions may be stored in a computerreadable medium as one or more instructions or codes, or transmittedthrough the computer readable medium. The computer readable mediumincludes computer storage medium and communication medium. Thecommunication media includes any medium that may be used to transmitcomputer programs from one location to another location. The storagemedium may be any available medium that is accessible by a general orspecial computer. For example, but without limitation, the computerreadable medium may include a RAM, a ROM, an EEPROM, a CD-ROM or otherCD storage devices, disk storage device or other magnetic storagedevices, or any other medium that may be used to carry or store therequired program codes in a form of instructions or data structure andmay be accessible by a general or special computer or a general orspecial processor. In addition, any connection may be appropriatelycalled as a computer-readable medium. For example, if a coaxial cable, afiber optic cable, a twisted pair, a digital subscriber line (DSL) orwireless technologies such as infrared rays, radio and microwave areused to transmit software from a website, a server or other remotesource, the above coaxial cable, the fiber optic cable, the twistedpair, the DSL or wireless technologies such as infrared rays, radio andmicrowave are all within the definition of the medium. As used herein,the disk and the optical disk includes a compression disk (CD), a laserdisc, an optical disk, a digital versatile disc (DVD), a floppy disksand a blue-ray disk, wherein the magnetic disk normally represents datamagnetically, and the optical disk represents data optically byutilizing a laser. The combination of the above may also be included inthe scope of the computer readable medium.

Although the exemplary embodiments of the present disclosure have beenillustrated in the above, it may be noticed that, various alteration andmodification may be made without departing the scope of the presentdisclosure, which is defined by the claims. The functions, steps and/oroperations of the method claims according to the described embodimentsof the present disclosure, may not be performed in a particular order.In addition, although elements of the present disclosure may bedescribed or prescribed in a single form, multiple forms may also bedevised, unless the single form is explicitly prescribed.

The objects, technical solutions and advantageous effects of the presentdisclosure have been explained in a further detail with the abovespecific embodiments. It may be appreciated that, the above are merelyspecific embodiments of the present disclosure, and not used to limitthe scope of the present disclosure. Any alteration, equivalentreplacement, modification and the like within the spirit and principleof the present disclosure may be embraced in the protection scope of thepresent disclosure.

What is claimed is:
 1. A method for selecting a character from contentdisplayed in a touch screen, comprising: detecting a touch point of auser gesture acting on the touch screen, wherein the touch point fallsinto a touch point node; searching a plurality of nodes of the contentsto find a nearest text node to the touch point, when the touch pointnode is not a text node, wherein the plurality of nodes are organized asa node tree, wherein searching the plurality of nodes comprisesdetermining whether the touch point node contains any text node;calculating the distance between the touch point and each text nodecontained in the touch point node when the touch point node contains atleast one text node, wherein calculating the distance comprisesdetermining the coordinates of the four vortex of the at least one textnode; and calculating the distance between the touch point and each textnode according to the coordinates of the touch point and the coordinatesof the four vortex of the at least one text node, wherein thecoordinates of the touch point are (m, n), the coordinates of the lowerleft vertex of a text node are (x₁, y₁) the coordinates of the upperleft vertex are (x₁, y₂), the coordinates of the upper right vertex are(x₂, y₂), and the coordinates of the lower right vertex are (x₂, y₁),wherein if m<x₁, and n<y₂, the distance is √{square root over((x₁−m)²+(n−y₂)²)}; if m<x₁, and y₂<n<y₁, the distance is |x₁−m|; ifm<x₁, and n>y₁, the distance is √{square root over ((x₁−m)²+(n−y₁)²)};if x₁<m<x₂, and n>y₁, the distance is |y₁−n|; if m>x₂, and n>y₁, thedistance is √{square root over ((x₂−m)²+(y₁−n)²)}; if m>x₂, and y₂<n<y₁,the distance is |m−x₂|; if m>x₂, and n<y₂, the distance is √{square rootover ((x₂−m)²+(y₂−n)²)}; and if x₁<m<x₂, and n<y₂, the distance is|n−y₂|; and selecting the text node of the smallest distance as thenearest text node to the touch point; and selecting a nearest characterto the touch point within the nearest text node.
 2. The method accordingto claim 1, further comprising: determining whether a sibling node ofthe touch point node contains any text node, when the touch point nodedoes not contain at least one text node; and calculating the distancebetween each text node contained in the sibling node and the touch pointwhen the sibling node contains at least one text node.
 3. The methodaccording to claim 1, further comprising: determining whether a siblingnode of a parent node of the touch point node contains any text node,when none of the sibling nodes of the touch point node contains any textnode; and calculating the distance between each text node contained inthe sibling node of the parent node of the touch point node and thetouch point when the sibling node of the parent node of the touch pointnode contains at least one text node.
 4. The method according to claim1, wherein selecting the nearest character to the touch point within thenearest text node comprises: determining the coordinates of the nearestcharacter to the touch point; and selecting the character according tothe determined coordinates.
 5. The method according to claim 4, whereindetermining the coordinates of the nearest character to the touch pointcomprises: if m<x₁, and n<y₂, the coordinates of the nearest characterare$\left( {{x_{1} + {\frac{1}{2} \times w}},{y_{2} + {\frac{1}{2} \times h}}} \right);$if m<x₁, and y₂≦n≦y₁, the coordinates of the nearest character are$\left( {{x_{1} + {\frac{1}{2} \times w}},n} \right);$ if m<x₁, andn>y₁, the coordinates of the nearest character are$\left( {{x_{1} + {\frac{1}{2} \times w}},{y_{1} - {\frac{1}{2} \times h}}} \right);$if x₁≦m≦x₂, and n>y₁, the coordinates of the nearest character are$\left( {m,{y_{1} - {\frac{1}{2} \times h}}} \right);$ if m>x₂, andn>y₁, the coordinate of the nearest character are$\left( {{x_{2} - {\frac{1}{2} \times w}},{y_{1} - {\frac{1}{2} \times h}}} \right);$if m>x₂, and y₂≦n≦y₁, the coordinates of the nearest character are$\left( {{x_{2} - {\frac{1}{2} \times w}},n} \right);$ if m>x₂, andn<y₂, the coordinates of the nearest character are$\left( {{x_{2} - {\frac{1}{2} \times w}},{y_{2} + {\frac{1}{2} \times h}}} \right);$and if x₁≦m≦x₂, and n<y₂, the coordinates of the nearest character are$\left( {m,{y_{2} + {\frac{1}{2} \times h}}} \right),$ wherein w is thewidth of a character, and h is the height of a character.
 6. The methodaccording to claim 1, wherein the text node is a visible text node.
 7. Aterminal device, comprising: a touch screen for displaying content; aprocessor; and a memory for storing instructions executable by theprocessor, wherein the processor is configured to execute instructionsfor: detecting a touch point of a user gesture acting on the touchscreen, wherein the touch point falls into a touch point node; searchinga plurality of nodes of the contents to find a nearest text node to thetouch point, when the touch point node is not a text node, wherein theplurality of nodes are organized as a node tree, and searching theplurality of nodes comprises determining whether the touch point nodecontains any text node; calculating the distance between the touch pointand each text node contained in the touch point node when the touchpoint node contains at least one text node, wherein calculating thedistance comprises determining the coordinates of the four vortex of theat least one text node; and calculating the distance between the touchpoint and each text node according to the coordinates of the touch pointand the coordinates of the four vortex of the at least one text node,wherein the coordinates of the touch point are (m, n), the coordinatesof the lower left vertex of a text node are (x₁, y₁) the coordinates ofthe upper left vertex are (x₁, y₂), the coordinates of the upper rightvertex are (x₂, y₂), and the coordinates of the lower right vertex are(x₂, y₁), wherein if m<x₁, and n<y₂, the distance is √{square root over((x₁−m)²+(n−y₂)²)}; if m<x₁, and y₂<n<y₁, the distance is |x₁−m|; ifm<x₁, and n>y₁, the distance is √{square root over ((x₁−m)²+(n−y₁)²)};if x₁<m<x₂, and n>y₁, the distance is |y₁−n|; if m>x₂, and n>y₁, thedistance is √{square root over ((x₂−m)²+(y₁−n)²)}; if m>x₂, and y₂<n<y₁,the distance is |m−x₂|; if m>x₂, and n<y₂, the distance is √{square rootover ((x₂−m)²+(y₂−n)²)}; and if x₁<m<x₂, and n<y₂, the distance is|n−y₂|; and selecting the text node of the smallest distance as thenearest text node to the touch point; and selecting a nearest characterto the touch point within the nearest text node.
 8. The terminal deviceaccording to claim 7, wherein the processor is further configured toexecute instructions for: determining whether a sibling node of thetouch point node contains any text node, when the touch point node doesnot contain at least one text node; and calculating the distance betweeneach text node contained in the sibling node and the touch point whenthe sibling node contains at least one text node.
 9. The terminal deviceaccording to claim 7, wherein the processor is further configured toexecute instructions for: determining whether a sibling node of a parentnode of the touch point node contains any text node, when none of thesibling nodes of the touch point node contains any text node; andcalculating the distance between each text node contained in the siblingnode of the parent node of the touch point node and the touch point whenthe sibling node of the parent node of the touch point node contains atleast one text node.
 10. The terminal device according to claim 7,wherein selecting the nearest character to the touch point within thenearest text node comprises: determining the coordinates of the nearestcharacter to the touch point; and selecting the character according tothe determined coordinates.
 11. The terminal device according to claim10, wherein determining the coordinates of the nearest character to thetouch point comprises: if m<x₁, and n<y₂, the coordinates of the nearestcharacter are$\left( {{x_{1} + {\frac{1}{2} \times w}},{y_{2} + {\frac{1}{2} \times h}}} \right);$if m<x₁, and y₂≦n≦y₁, the coordinates of the nearest character are$\left( {{x_{1} + {\frac{1}{2} \times w}},n} \right);$ if m<x₁, andn>y₁, the coordinates of the nearest character are$\left( {{x_{1} + {\frac{1}{2} \times w}},{y_{1} - {\frac{1}{2} \times h}}} \right);$if x₁≦m≦x₂, and n>y₁, the coordinates of the nearest character are$\left( {m,{y_{1} - {\frac{1}{2} \times h}}} \right);$ if m>x₂, andn>y₁, the coordinate of the nearest character are$\left( {{x_{2} - {\frac{1}{2} \times w}},{y_{1} - {\frac{1}{2} \times h}}} \right);$if m>x₂, and y₂≦n≦y₁, the coordinates of the nearest character are$\left( {{x_{2} - {\frac{1}{2} \times w}},n} \right);$ if m>x₂, andn<y₂, the coordinates of the nearest character are$\left( {{x_{2} - {\frac{1}{2} \times w}},{y_{2} + {\frac{1}{2} \times h}}} \right);$and if x₁≦m≦x₂, and n<y₂, the coordinates of the nearest character are$\left( {m,{y_{2} + {\frac{1}{2} \times h}}} \right),$ wherein w is thewidth of a character, and h is the height of a character.
 12. Anon-transitory readable storage medium including instructions,executable by a processor in a terminal device, for performing themethod for selecting a character from content displayed in a touchscreen, the method comprising: detecting a touch point of a user gestureacting on the touch screen, wherein the touch point falls into a touchpoint node; searching a plurality of nodes of the contents to find anearest text node to the touch point, when the touch point node is not atext node, wherein the plurality of nodes are organized as a node tree,wherein searching the plurality of nodes comprises determining whetherthe touch point node contains any text node; calculating the distancebetween the touch point and each text node contained in the touch pointnode when the touch point node contains at least one text node, whereincalculating the distance comprises determining the coordinates of thefour vortex of the at least one text node; and calculating the distancebetween the touch point and each text node according to the coordinatesof the touch point and the coordinates of the four vortex of the atleast one text node, wherein the coordinates of the touch point are (m,n), the coordinates of the the lower left vertex of a text node are (x₁,y₁) the coordinates of the upper left vertex are (x₁, y₂), thecoordinates of the upper right vertex are (x₂, y₂), and the coordinatesof the lower right vertex are (x₂, y₁), wherein if m<x₁, and n<y₂, thedistance is √{square root over ((x₁−m)²+(n−y₂)²)}; if m<x₁, and y₂<n<y₁,the distance is |x₁−m|; if m<x₁, and n>y₁, the distance is √{square rootover ((x₁−m)²+(n−y₁)²)}; if x₁<m<x₂, and n>y₁, the distance is |y₁−n|;if m>x₂, and n>y₁, the distance is √{square root over((x₂−m)²+(y₁−n)²)}; if m>x₂, and y₂<n<y₁, the distance is |m−x₂|; ifm>x₂, and n<y₂, the distance is √{square root over ((x₂−m)²+(y₂−n)²)};and if x₁<m<x₂, and n<y₂, the distance is |n−y₂|; and selecting the textnode of the smallest distance as the nearest text node to the touchpoint; and selecting a nearest character to the touch point within thenearest text node.